class filterForgeWebServiceObject

	public webServiceAddress, webServiceAction, webServiceRequest
	
	public base64, parse
	
	public filterList


	public default function init()
	
		webServiceAddress="https://filterforge.net/Service/FilterLibService.asmx"
		
		webServiceAction="http://tempuri.org/"
		
		webServiceRequest="<?xml version=""1.0"" encoding=""UTF-8""?><SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:ns1=""http://tempuri.org/"">"	
		set base64=(new base64Object)()
		set parse=(new parseObject)("")
		set init = me
		
	end function
	
	
	function getFilterList()
	
		set filterListLocal=CreateObject("Scripting.Dictionary")
		set idParse=(new parseObject)("")
		set versionParse=(new parseObject)("")
			
		parse.rawPage=con.getSOAPPage(webServiceAddress,"POST",webServiceAction & "GetFamiliesVersions" ,webServiceRequest & "<SOAP-ENV:Body><ns1:GetFamiliesVersions></ns1:GetFamiliesVersions></SOAP-ENV:Body></SOAP-ENV:Envelope>")

		parse.extract "<filters>","</filters>"

		idParse.rawPage=parse.result
		idParse.extract "<id>","</id>"

		versionParse.rawPage=parse.result
		versionParse.extract "<version>","</version>"

		for index=0 to uBound(idParse.dataList)
			id=idParse.dataList(index)
			version=versionParse.dataList(index)
			
			if filterListLocal.exists(id) then
				currentData=filterListLocal.item(id)
				filterListLocal.item(id)=currentData + "," & version
			else
				filterListLocal.add id,version
			end if
			
		next
		set getFilterList=filterListLocal
		
	end function
	
	
	
	function getFilter(family,version)

		parse.rawPage=con.getSOAPPage(webServiceAddress,"POST",webServiceAction & "GetFilterXml" ,webServiceRequest & "<SOAP-ENV:Body><ns1:GetFilterXml><ns1:family>" & family & "</ns1:family><ns1:version>" & version & "</ns1:version></ns1:GetFilterXml></SOAP-ENV:Body></SOAP-ENV:Envelope>")
		
		parse.extract "<filterXml>","</filterXml>"
		
		getFilter=base64.Base64Decode(parse.result)
		
	end function





end class
